#ifndef APP_NOTIFY_MANAGER_H 
#define APP_NOTIFY_MANAGER_H

#include <iostream>
#include <queue>
#include <memory>
#include <mutex>
#include <log_err.h>
#include "thread/threading.h"

struct Notify
{
    Notify():notifyId(0), data(nullptr){
        SIGNWAY_LOGI("Notify()");
    }
    Notify(int notifyId, void* data):notifyId(notifyId), data(data){
        SIGNWAY_LOGI("Notify()");
    }
    ~Notify() {
        SIGNWAY_LOGI("~Notify()");
    }
    int notifyId;
    void* data;
};

class NotifyQueue : public Thread {
private:
    NotifyQueue(/* args */);
    ~NotifyQueue();
    void clear();
    std::mutex mutex;
    std::queue<std::shared_ptr<Notify>> notifyQueue;
    static NotifyQueue* instance;
    bool threadIsStarted = false;
public:
    void threadMain();/* 发送通知-消费者 */
    void sendNotify(int notifyId, void* data);
    static NotifyQueue* getInstance();
};

#endif